package com.leyu.mall.service.mdm.impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.leyu.mall.dao.mdm.MDMPriceRegionMapper;
import com.leyu.mall.domain.mdm.MDMPriceRegion;
import com.leyu.mall.service.mdm.IMDMPriceRegionService;

@Service
@Transactional(rollbackFor=Exception.class)
public class MDMPriceRegionServiceImpl implements IMDMPriceRegionService {
	
	@Resource
	private MDMPriceRegionMapper mdmPriceRegionMapper;
	

	public MDMPriceRegion find(Long entity_id)  throws Exception{
		return mdmPriceRegionMapper.getMDMPriceRegionById(entity_id);
	}

	public void save(MDMPriceRegion entity) throws Exception{
		if(entity.getPriceRegionId()== null){
			mdmPriceRegionMapper.addMDMPriceRegion(entity);
			
		}
		else{
		
			mdmPriceRegionMapper.updateMDMPriceRegion(entity);
		}
 
	}
	public void delete(Long  id)throws Exception{
		mdmPriceRegionMapper.deleteMDMPriceRegion(id);
	}
	
	
	public List<MDMPriceRegion> getMDMPriceRegionList()throws Exception{
		 
 
		return mdmPriceRegionMapper.getAllMDMPriceRegion();
		
	}
	
	/**
	 * 查询广告列表
	 */
	public List<MDMPriceRegion> getDisplayADList()throws Exception{	 
		return mdmPriceRegionMapper.getDisplayMDMPriceRegionList();
		
	}
	
	
}